export interface ApiResponseMeta {
  timestamp?: string;
  path?: string;
  method?: string;
  duration?: string;
}

export interface PaginationMeta {
  pageNum: number;
  pageSize: number;
  total: number;
  totalPages: number;
}

export type ApiResponse<T = any> = SuccessResponse<T> | ErrorResponse;

// 成功响应
export interface SuccessResponse<T = any> {
  code: 0; // 业务成功固定 0
  message: string; // 成功提示
  data: T; // 实际数据
  meta?: ApiResponseMeta; // 可选元数据
  pagination?: PaginationMeta; // 仅在分页时存在
}

// 失败响应
export interface ErrorResponse {
  code: number; // 业务错误码 > 0
  message: string; // 错误描述
  errors?: Record<string, any>; // 字段级错误
  meta?: ApiResponseMeta;
}
